from datetime import datetime
from typing import Optional, Union, List
from pydantic import BaseModel
from schemas.flower import FlowerModel


class CreateConfigRequest(BaseModel):
    created_on: Optional[datetime] = None
    created_by: Optional[int] = None
    name: str
    data: Union[dict, list]


class ConfigModel(BaseModel):
    id: int
    created_on: Optional[datetime] = None
    created_by: Optional[int] = None
    updated_on: Optional[datetime] = None
    updated_by: Optional[int] = None
    status: Optional[int] = 1
    name: str
    data: Union[dict, list]

    class Config:
        from_attributes = True


class UpdateConfigRequest(BaseModel):
    updated_on: Optional[datetime] = None
    updated_by: Optional[int] = None
    name: str
    data: Union[dict, list]


class TodayRecommendItem(BaseModel):
    id: int
    flower_id: int
    title: str
    tag: Optional[str] = None
    flower: FlowerModel


class HomeRecommendItem(BaseModel):
    id: int
    title: str
    children: List[FlowerModel]
